import axios from './axios'
export default {
  //获取列表
  getUsersList(query,pagenum,pagesize) {
    return axios.get(`users?query=${query}&pagenum=${pagenum}&pagesize=${pagesize}`)
  },
  //修改状态
  editSwitch(id,state){
    return axios.put(`users/${id}/state/${state}`)
  },
  //添加用户
  addUsers(form){
      return axios.post(`users`,form)
  },
  //修改用户对话框
  showEdit(id){
    return axios.get(`users/${id}`)
  },
  //修改用户
  editUser(id,form){
      return axios.put(`users/${id}`,form)
  },
  //删除用户
  deleteUser(id){
    return axios.delete(`users/${id}`)
  },
  //分配角色
  saveRole(id,rid){
    return axios.put(`users/${id}/role`,rid)
  },
  setRoles(){
    return axios.get(`roles`)
  }
}